package com.itheima.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Duration;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
public class RequestLocal {
    private String id;
    private String servletPath;
    private LocalDateTime requestTime;
    private LocalDateTime responseTime;

    public RequestLocal(String id, String servletPath, LocalDateTime requestTime){
        this.id = id;
        this.servletPath = servletPath;
        this.requestTime = requestTime;
    }

    public long duration(){
        Duration duration = Duration.between(this.requestTime,this.responseTime);
        long seconds = duration.toMillis(); // 相差的秒数
        return seconds;
    }

}
